package routers

import (
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
	"novel-mng-sys/handlers"
)

func Init() *gin.Engine {

	r := gin.Default()

	//跨域
	r.Use(cors.Default())
	//静态文件
	r.Static("static", "./static")

	r.GET("/test", handlers.Test) //测试路由

	r.POST("/user/login", handlers.Login) //登录接口
	
	r.GET("/novel/list", handlers.NovelList)     //小说列表
	r.GET("/novel/detail", handlers.NovelDetail) //小说详情

	return r
}
